using System.IO;
using Framework.Core.Io;

namespace Framework.Core.Process.Tasks
{
    internal struct TaskKill : ICommand
    {
        private const string TaskkillPath = @"c:\windows\system32\taskkill.exe";
        private static readonly string TaskkillExe = Path.GetFileNameWithoutExtension(TaskkillPath);

        public TaskKill(string processName)
            : this(TaskkillExe, TaskkillPath, string.Format(@"/IM {0} /F /T", processName))
        {
        }

        public TaskKill(int pid)
            : this(TaskkillExe, TaskkillPath, string.Format(@"/PID {0} /F /T", pid))
        {
        }

        private TaskKill(string name, string fileName, string arguments)
            : this()
        {
            Name = name;
            FileName = fileName;
            Arguments = arguments;
        }

        public string Name { get; private set; }
        public string FileName { get; private set; }
        public string Arguments { get; private set; }
        public bool IsNative { get { return true; } }
    }
}